<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // charAt返回指定位置的字符，参数从0开始。
        var name = "dajiahaowoshigaoweijie"
        console.log(name.length);
        document.write(name.charAt(name.length - 1));
        // 如果参数为负数，或大于字符串长度，则返回空字符串。
        let num = "jintianshixingqiyi"
        console.log(num.charAt(100));
        
    </script>
</body>
</html>